package com.atguigu.order.interceptor;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

import java.util.UUID;

/**
 * @Author 海晨忆
 * @Des OpenFeign的请求拦截器
 * @Date 2025/7/23 10:23
 */
@Component
public class XTokenRequestInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate requestTemplate) {
        //给请求头添加一个xToken的字段
        requestTemplate.header("xToken", UUID.randomUUID().toString());
    }
}
